const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  // ranspileDependencies: true,
  lintOnSave: false,
  configureWebpack: {
    devtool: 'source-map'
  },
  devServer: {
    // proxy: 'http://localhost:5000'
    // proxy: 'http://120.78.226.229:8848'
    proxy: {
      '/api': {
        target: 'http://localhost:5000/',
        pathRewrite: { '^/api': '/api' },  //将api 替换为 空
        secure: false,
        logLevel: 'debug',
        ws: false,
        changeOrigin: true
      },
      '/qiniu': {
        target: 'https://www.qiniu.com/',
        logLevel: 'debug',
        pathRewrite: { '^/qiniu': '' },  //将api 替换为 空
        secure: false,
        ws: false,
        changeOrigin: true
      },
      '/': {
        target: 'http://localhost:5000/',
        //pathRewrite: { '/api': '/api' },  //将api 替换为 空
        secure: false,
        ws: false,
        logLevel: 'debug',
        changeOrigin: true
      }
    },
    open: true,
    host: 'localhost'
  },
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = '后台管理系统'
        return args
      })
  }
})
